package zuoye01;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;

public class Test01 {

	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		ArrayList<Integer> list=new ArrayList<Integer>(5);		
		System.out.println("请输入五名学生成绩：");
		for (int i = 0; i < 5; i++) {
			list.add(input.nextInt());
		}
		int max=  list.get(0);
		for (int i = 0; i < 5; i++) {
			if (max< list.get(i)) {
				max= list.get(i);
			}
		}
		int min=list.get(0);
		for (int i = 0; i < 5; i++) {
			if (min>list.get(i)) {
				min=list.get(i);
			}
		}
		System.out.println("最小值"+min);
		System.out.println("最大值："+max);
		  Collections.sort(list);
	      for (Object obj : list) {
	    		System.out.println(obj);	
		}
		
	      System.out.println("最小值："+list.get(list.get(0)));
  		System.out.println("最大值："+list.get(list.get(list.size()-1)));
	}
}
